System.IComparable.CompareTo Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Compares this pair to another pair of the some type. The pairs are compared by using the IComparable<T> or IComparable interface on TFirst and TSecond. The pairs are compared by their first elements first, if their first elements are equal, then they are compared by their second elements.

If either TFirst or TSecond does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the pairs cannot be compared.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
private int IComparable.CompareTo(
	Object obj
)
Visual Basic (Declaration)
Private Function System.IComparable.CompareTo ( _
	obj As Object _
) As Integer Implements IComparable.CompareTo
Visual C++
private:
virtual int System.IComparable.CompareTo (
	Object^ obj
) sealed = IComparable::CompareTo

Parameters

obj
Object
The pair to compare to.

Return Value

An integer indicating how this pair compares to obj. Less than zero indicates this pair is less than obj. Zero indicate this pair is equals to obj. Greater than zero indicates this pair is greater than obj.

Exceptions

ExceptionCondition
System..::ArgumentExceptionobj is not of the correct type.
System..::NotSupportedExceptionEither FirstSecond or TSecond is not comparable via the IComparable<T> or IComparable interfaces.

See Also